(function(vc) {
    vc.extends({
        propTypes: {
            callBackListener: vc.propTypes.string, //父组件名称
            callBackFunction: vc.propTypes.string //父组件监听方法
        },
        data: {
            addRouteViewInfo: {
                flowComponent: 'addRouteView',
                orderTypeCd: '',
                invokeLimitTimes: '1000',
                invokeModel: 'S'
            }
        },
        watch: {
            addRouteViewInfo: {
                deep: true,
                handler: function() {
                    $that.saveAddRouteInfo();
                }
            }
        },
        _initMethod: function() {},
        _initEvent: function() {
            vc.on('addRouteViewInfo', 'onIndex', function(_index) {
                $that.addRouteViewInfo.index = _index;
            });
        },
        methods: {
            addRouteValidate() {
                return vc.validate.validate({
                    addRouteViewInfo: $that.addRouteViewInfo
                }, {
                    'addRouteViewInfo.orderTypeCd': [{
                            limit: "required",
                            param: "",
                            errInfo: "订单类型不能为空"
                        },
                        {
                            limit: "maxin",
                            param: "1,4",
                            errInfo: "订单类型错误"
                        },
                    ],
                    'addRouteViewInfo.invokeLimitTimes': [{
                            limit: "required",
                            param: "",
                            errInfo: "调用次数不能为空"
                        },
                        {
                            limit: "num",
                            param: "",
                            errInfo: "调用次数错误"
                        },
                    ],
                    'addRouteViewInfo.invokeModel': [{
                            limit: "required",
                            param: "",
                            errInfo: "调用方式不能为空"
                        },
                        {
                            limit: "maxLength",
                            param: "50",
                            errInfo: "消息队列不能超过50"
                        },
                    ]
                });
            },
            saveAddRouteInfo: function() {
                if ($that.addRouteValidate()) {
                    //侦听回传
                    vc.emit($props.callBackListener, $props.callBackFunction, $that.addRouteViewInfo);
                    return;
                }
            }
        }
    });
})(window.vc);